
const express = require('express');
const router = express.Router();

router.get('/hello', (req, res) => {
  const name = req.query.name || 'Guest';
  res.send(`Hello, ${name}!`);
});

router.get('/index', (req, res) => {
  const data = require('../mock/index.json')
  console.log(data)
  res.json(data);
});

router.get('/test', (req, res) => {
  const data = require('../mock/hello.json')
  console.log(data)
  res.send(data);
});

router.post('/add', (req, res) => {
  // 模拟添加商品逻辑
  res.json({ message: 'Product added' });
});

module.exports = router;